<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        #box1{
            width: 100px;
            height: 100px;
            background-color: #9a6e3a;
        }
    </style>
    <script>
        window.onload = function () {
            var btn = document.getElementById('btn');
            var w = 100;
            btn.onclick = function () {
                var box1 = document.getElementById('box1');
                w +=100;
                box1.style.width = w+'px';
                box1.style.height = w+'px';
                box1.style.backgroundColor = 'red';

            }

        }
    </script>
</head>
<body>
<button id="btn">这是一个按钮</button>

<div id="box1"></div>
</body>
</html>